{extend name="base" /}
{block name="title"}{$userInfo['nickname']}-认证身份|程序员的收藏夹-专注于程序员学习、分享{/block}

{block name="style"}
<style type="text/css">
	.box-title.icon::before{
		color: #4a4a4a;
	}
</style>
{/block}

{block name="header"}
	{include file="public/user_header" /}
{/block}

{block name="content"}
<div class="zbd-content">
	<div class="page">
		<div class="user-home">
			<div class="home-menu left yy">
				{include file="public/user_left_nav" /}
			</div>
			<div class="home-body right">
				<div class="row">
					<div class="w12">
						<div class="box yy">
							<div class="box-title icon ice-check-round">
								<div class="left bold">身份认证</div>
							</div>
							<div class="box-content">
								<div class="profile">
									{if condition="$userInfo['auth_type'] == 1"}
									<div class="tip bg-blue" id="auth_type_ok">
										<div class="title-l">认证通过</div>
										<p class="tg">姓名：<span id="name">{$userInfo['name']}</span></p>
										<p class="tg">手机：<span id="phone">{$userInfo['phone']}</span></p>
									</div>
									{else /}
									<form id="formData" id="auth_type_no">
										<fieldset class="pt40 pb40 pt40">
										    <legend class="bg-red">身份认证</legend>
										    <div class="group-form">
											    <div class="group-label">真实姓名</div>
											    <div class="group-content mb30">
											        <input type="text" class="form-control" name="name" placeholder="请输入姓名" value="{$userInfo['name']}">
											    </div>
											</div>

											<div class="group-form">
											    <div class="group-label">手机号码</div>
											    <div class="group-content">
											        <input type="text" class="form-control" name="phone" placeholder="请输入手机号码" value="{$userInfo['phone']}">
											    </div>
											</div>

										</fieldset>

										<div class="group-form">
										    <div class="group-label"></div>
										    <div class="group-content">
										        <input type="button" class="btn bg-green mr20" id="submit" value="提交">
										    </div>
										</div>
									</form>
									{/if}
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
	ice(function(){

		ice("#submit").click(function(e){
			var data = ice('#formData').form();
			console.log(data)
			if(data.name == ''){
				ice.pop({content:'请输入真实姓名',icon:'fail'})
				return false;
			}
			if(data.phone == ''){
				ice.pop({content:'请输入手机号码',icon:'fail'})
				return false;
			}
			ice.ajax({
			    url:'/user/auth',
			    type:'post',
			    data:data,
			    success:function(res){
			    	ui.loadClose()
			        if(res.code == 1){
			            ice.pop({content:res.message,icon:'fail'})
			            return false;
			        }else{
			        	ice.pop({content:res.message,icon:'success'})
			        	setTimeout (function(){
							location.reload();
						},2000);//参数是函数名
			        }
			    }
			});
		})
	})
</script>

{/block}